<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/10/28
  Time: 10:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>Title</title>
</head>
<body>
<%
  //使用pageContext设置属性,该属性默认在page范围内
  pageContext.setAttribute("pageContext","pageContext");

  //使用request设置属性,该属性默认在request范围内
  request.setAttribute("request","request");

  //使用session将属性设置在session范围内
  session.setAttribute("session","session");

  //使用application将属性设置在application范围内
  application.setAttribute("application","application");
%>
<%--重定向 路径发生变化 1个null--%>
<%--<jsp:forward page="demo003.jsp"></jsp:forward>--%>
<%--转发 路径不发生变化 2个null--%>
<% response.sendRedirect("http://localhost:8080/demo003.jsp");%>
<table>
  <tr>
    <td>pageContext值:</td>
    <td><%=pageContext.getAttribute("pageContext")%></td>
  </tr>
  <tr>
    <td>request值:</td>
    <td><%=request.getAttribute("request")%></td>
  </tr>
  <tr>
    <td>session值:</td>
    <td><%=session.getAttribute("session")%></td>
  </tr>
  <tr>
    <td>application值:</td>
    <td><%=application.getAttribute("application")%></td>
  </tr>
</table>

</body>
</html>